class FlickrsController < ApplicationController
  # GET /flickrs
  # GET /flickrs.xml
  def index
    @flickrs = Flickr.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @flickrs }
    end
  end

  # GET /flickrs/1
  # GET /flickrs/1.xml
  def show
    @flickr = Flickr.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @flickr }
    end
  end

  # GET /flickrs/new
  # GET /flickrs/new.xml
  def new
    @flickr = Flickr.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @flickr }
    end
  end

  # GET /flickrs/1/edit
  def edit
    @flickr = Flickr.find(params[:id])
  end

  # POST /flickrs
  # POST /flickrs.xml
  def create
    @flickr = Flickr.new(params[:flickr])

    respond_to do |format|
      if @flickr.save
        flash[:notice] = 'Flickr was successfully created.'
        format.html { redirect_to(@flickr) }
        format.xml  { render :xml => @flickr, :status => :created, :location => @flickr }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @flickr.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /flickrs/1
  # PUT /flickrs/1.xml
  def update
    @flickr = Flickr.find(params[:id])

    respond_to do |format|
      if @flickr.update_attributes(params[:flickr])
        flash[:notice] = 'Flickr was successfully updated.'
        format.html { redirect_to(@flickr) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @flickr.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /flickrs/1
  # DELETE /flickrs/1.xml
  def destroy
    @flickr = Flickr.find(params[:id])
    @flickr.destroy

    respond_to do |format|
      format.html { redirect_to(flickrs_url) }
      format.xml  { head :ok }
    end
  end
end
